// reduce+concat
//只实现了一层展开，无法传递参数继续展开
let test = [1,2,,null,[3,4,[5,6,[7,8]]]]
Array.prototype.myFlat = function(deep){
    if(deep <= 0) return this
    let res = this
    res=res.reduce((n,l)=>{
        return n.concat(l)
    },[])
    return res
}

console.log(test.myFlat());